#ifndef WATCHDIINSTRUCTIONLOGIC_H
#define WATCHDIINSTRUCTIONLOGIC_H

#include "ioinstruction.h"
#include "programset.h"
#include "instructionEnum.h"
#include "robotio.h"
#include "GeneralDefine.h"

class ProgramEngine;

class WatchDIInstructionLogic
{
public:
    WatchDIInstructionLogic(QString configFilePathIn,int robotIdIn,ProgramSet* programSetIn,RobotIo* ioControllerIn,
                            ProgramEngine* programEngineIn);
public:
    E_PROGRAM_LOOP_RESULT startWatchDI(int programNum,WatchDIInstruction watchDIInstruct);

private:
    void realTimeSleep(long long umicoroSecond);
    /**
     * @brief addMsg  , 添加消息反馈
     * @param messageLevel
     * @param componentName
     * @param messageType
     * @param messageCode
     * @param robotId
     * @param parameter1
     * @param parameter2
     * @param parameter3
     * @param parameter4
     */
    void addMsg( int messageLevel,
                 std::string componentName,
                 std::string messageType,
                 int messageCode,
                 int robotId,
                 int parameter1 = 0,
                 int parameter2 = 0,
                 int parameter3 = 0,
                 int parameter4 = 0,
                 QString message= "");
private:
    int robotId;
    ProgramSet* programSet;
    RobotIo* ioController;
    ProgramEngine* programEngine;
    QString configFilePath;
};
#endif // WATCHDIINSTRUCTIONLOGIC_H
